(define (domain pr2-tamp)
  (:requirements :strips :equality)
  (:constants @sink @stove)
  (:predicates
    (Arm ?a)
    (Stackable ?o ?r)
    (Type ?t ?b)

    (Pose ?o ?p)
    (Grasp ?o ?g)
    (Kin ?a ?o ?p ?g ?q ?t)
    (BaseMotion ?q1 ?t ?q2)
    (ArmMotion ?a ?q1 ?t ?q2)
    (Supported ?o ?p ?r)
    (BTraj ?t)
    (ATraj ?t)

    (CFreeTrajPose ?t ?o2 ?p2)

    (AtPose ?o ?p)
    (AtGrasp ?a ?o ?g)
    (HandEmpty ?a)
    (AtBConf ?q)
    (AtAConf ?a ?q)
    (CanMove)

    (On ?o ?r)
    (Holding ?a ?o)
  )
  (:functions
    (Distance ?q1 ?q2)
    (MoveCost ?t)
    (PickCost)
    (PlaceCost)
  )

  (:action move_base
    :parameters (?q1 ?q2 ?t)
    :precondition (and (BaseMotion ?q1 ?t ?q2)
                       (AtBConf ?q1) (CanMove)
                   )
    :effect (and (AtBConf ?q2)
                 (not (AtBConf ?q1)) (not (CanMove))
                 (increase (total-cost) (Distance ?q1 ?q2)))
  )

  (:action pick
    :parameters (?a ?o ?p ?g ?q ?t)
    :precondition (and (Kin ?a ?o ?p ?g ?q ?t)
                       (AtPose ?o ?p) (HandEmpty ?a) (AtBConf ?q)
                       (forall (?o2 ?p2)
                         (imply (and (AtPose ?o2 ?p2) (not (= ?o ?o2)))
                                (CFreeTrajPose ?t ?o2 ?p2)))
                  )
    :effect (and (AtGrasp ?a ?o ?g) (CanMove)
                 (not (AtPose ?o ?p)) (not (HandEmpty ?a))
                 (increase (total-cost) (PickCost))
                 (forall (?r) (when (Supported ?o ?p ?r) (not (On ?o ?r))))
                 )
  )
  (:action place
    :parameters (?a ?o ?p ?g ?q ?t)
    :precondition (and (Kin ?a ?o ?p ?g ?q ?t)
                       (AtGrasp ?a ?o ?g) (AtBConf ?q)
                       (forall (?o2 ?p2)
                         (imply (and (AtPose ?o2 ?p2) (not (= ?o ?o2)))
                                (CFreeTrajPose ?t ?o2 ?p2)))
                  )
    :effect (and (AtPose ?o ?p) (HandEmpty ?a) (CanMove)
                 (not (AtGrasp ?a ?o ?g))
                 (increase (total-cost) (PlaceCost))
                 (forall (?r) (when (Supported ?o ?p ?r) (On ?o ?r)))
                 )
  )
)